package contest.co6149;

public class Solution {
    public int edgeScore(int[] edges) {
        long[] res=new long[edges.length];
        for (int i = 0; i < edges.length; i++) {
            res[edges[i]]+=i;
        }
        int maxL=0;
        long max=res[0];
        for (int i = 1; i < res.length; i++) {
            if (max<res[i]){

                max=res[i];

                maxL=i;
            }
        }
        return maxL;
    }
}
